package Thread;
//使用callable更好地解决这个问题
public class ThreadDemo35 {
    private static int sum = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            int result = 0;
            for (int i = 1; i <= 1000 ; i++) {
                result += i;
            }
            sum += result;
        });
        t.start();
        t.join();
        System.out.println("sum = "+sum);
    }
}
